//index.js
//获取应用实例
var app = getApp()
Page({
  data: {
    activeIndex: 0,  // 当前TAB
     categories: [
      {
        id:"1",
        name:"荤菜"
      },{
        name:"素菜"
      },{
        name:"每日例汤"
      }
     ],

     menus:[
     ]
  },
  onLoad: function () {
    var that = this;
    this.getSystemInfo()
     app.getUserInfo(function (userInfo) {
        that.setData({
          userInfo: userInfo
        });
      })
  },
  getSystemInfo: function(){
        app.WxService.getSystemInfo()
        .then(data => {
            console.log(data)
            this.setData({
                deviceWidth: data.windowWidth,
                deviceHeight: data.windowHeight,
            })
        })
    },
    // 切换TAB
    changeTab(e) {
        const dataset = e.currentTarget.dataset
        const index = dataset.index
        const id = dataset.id

        this.setData({
            activeIndex: index,
            'goods.params.type': id,
        })
    },

    onRefreshGoods(){

    }
})
